//
//  ExpectIndustryDeleteView.m
//  MyProject
//
//  Created by 石小强 on 2018/4/18.
//  Copyright © 2018年 yanjiaming. All rights reserved.
//

#import "ExpectIndustryDeleteView.h"

@interface ExpectIndustryDeleteView()

@property (nonatomic, strong) IndustryModel *industry;

@end

@implementation ExpectIndustryDeleteView

- (instancetype)initWithFrame:(CGRect)frame andIndustryModel:(IndustryModel *)industry {
    if (self = [super initWithFrame:frame]) {
        
        self.industry = industry;
        
        self.backgroundColor = UIColorFromRGB(0xE2F2F4);
        self.layer.cornerRadius = 10;
        self.layer.masksToBounds = YES;
        
        [self initSubViewsWithFrame:frame];
    }
    return self;
}

- (void)initSubViewsWithFrame:(CGRect)frame {
    CGFloat labelW = [Tool sizeWithText:self.industry.industryName font:[UIFont fontWithName:@"PingFang SC" size:12]].width;
    UILabel *contentL = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, labelW, frame.size.height)];
    contentL.text = self.industry.industryName;
    contentL.font = [UIFont fontWithName:@"PingFang SC" size:12];
    contentL.textColor = UIColorFromRGB(0x00BCCC);
    [self addSubview:contentL];
    
    UIButton *deleteBtn = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(contentL.frame), 0, 28, contentL.mj_h)];
    [deleteBtn setImage:[UIImage imageNamed:@"ic_Label_detel"] forState:UIControlStateNormal];
    self.deleteBtn = deleteBtn;
    [self addSubview:deleteBtn];
}

@end
